﻿using System;
using AutoMapper;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Framework.UnitTestProject
{
    class FirstClass
    {
        public string NameTitle { get; set; }
    }

    public class SecondClass
    {
        public string NameTitle { get; set; }
    }

    [TestClass]
    public class AutoMapperUnitTest
    {

        [TestMethod]
        public void MapMethod()
        {
            var firstClass = new FirstClass() { NameTitle = "Meysam" };
            var secondClass = new SecondClass() { NameTitle = "Navaei" };
            var firsClass = Df.Framework.Helper.AutoMapper.Map<FirstClass, SecondClass>(firstClass);
            Assert.IsTrue(firstClass.NameTitle == secondClass.NameTitle, "Auto mapper self map is ok!");
        }
        [TestMethod]
        public void SelfMapMethod()
        {
            var firstClass = new FirstClass() { NameTitle = "Meysam" };
            var secondClass = new SecondClass() { NameTitle = "Navaei" };
            Df.Framework.Helper.AutoMapper.Map<FirstClass, SecondClass>(firstClass, ref secondClass);
            Assert.IsTrue(firstClass.NameTitle == secondClass.NameTitle, "Auto mapper self map is ok!");
        }

    }
}
